#include "src/lta.h"

#include <stdalign.h>
#include <stdint.h>
#include <stdlib.h>

#include "src/ltbase.h"
#include "src/ltpanic.h"

lt_UsingType(lt, USize);

lt_NoReturn static void
OutOfMemory(void) {
    lt_Panic("out of memory");
}

void*
lt_Malloc(lt_USize size) {
    void* ptr = malloc(size);
    if (ptr == NULL)
        OutOfMemory();
    return ptr;
}

void*
lt_Realloc(void* ptr, USize size) {
    ptr = realloc(ptr, size);
    if (ptr == NULL)
        OutOfMemory();
    return ptr;
}

void
lt_Free(void* ptr, USize size) {
    (void)size;
    free(ptr);
}
